<template>
  <s-modal
    title="新增"
    :visible="visible"
    width="800px"
    ok-text="保存"
    :confirm-loading="confirmLoading"
    :closable="!confirmLoading"
    @ok="save()"
    @cancel="()=>{if(!confirmLoading){ visible=false }}"
  >
    <div style="height:400px">
      <s-scroll>
        <s-form ref="form" :value="formValue">
          <s-form-item
            label="序号"
            size="middle"
            name="businessId"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入序号"
              v-model="formValue.businessId"
              />
          </s-form-item>
          <s-form-item
            label="时间"
            size="middle"
            name="date"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入时间"
              v-model="formValue.date"
              />
          </s-form-item>
          <s-form-item
            label="数据上报接口数"
            size="middle"
            name="dataReporting"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入数据上报接口数"
              v-model="formValue.dataReporting"
              />
          </s-form-item>
          <s-form-item
            label="数据上报服务调用次数"
            size="middle"
            name="dataReportingCall"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入数据上报服务调用次数"
              v-model="formValue.dataReportingCall"
              />
          </s-form-item>
          <s-form-item
            label="数据总量"
            size="middle"
            name="dataTotal"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入数据总量"
              v-model="formValue.dataTotal"
              />
          </s-form-item>
          <s-form-item
            label="同比上月增量"
            size="middle"
            name="thanLastmonthMany"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入同比上月增量"
              v-model="formValue.thanLastmonthMany"
              />
          </s-form-item>
          <s-form-item
            label="更新频率（天）"
            size="middle"
            name="updateFrequency"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入更新频率（天）"
              v-model="formValue.updateFrequency"
              />
          </s-form-item>
          <s-form-item
            label="娱乐场所"
            size="middle"
            name="entertainmentPlace"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入娱乐场所"
              v-model="formValue.entertainmentPlace"
              />
          </s-form-item>
          <s-form-item
            label="特种行业"
            size="middle"
            name="specialTrades"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入特种行业"
              v-model="formValue.specialTrades"
              />
          </s-form-item>
          <s-form-item
            label="智慧内保"
            size="middle"
            name="wisdomInsourcing"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入智慧内保"
              v-model="formValue.wisdomInsourcing"
              />
          </s-form-item>
          <s-form-item
            label="大型活动安保"
            size="middle"
            name="eventSecurity"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入大型活动安保"
              v-model="formValue.eventSecurity"
              />
          </s-form-item>
          <s-form-item
            label="公交管控"
            size="middle"
            name="transitControl"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入公交管控"
              v-model="formValue.transitControl"
              />
          </s-form-item>
          <s-form-item
            label="新兴业态"
            size="middle"
            name="emergingBusiness"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入新兴业态"
              v-model="formValue.emergingBusiness"
              />
          </s-form-item>
          <s-form-item
            label="智慧检查站"
            size="middle"
            name="smartCheckpoint"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入智慧检查站"
              v-model="formValue.smartCheckpoint"
              />
          </s-form-item>
          <s-form-item
            label="危爆物品管控"
            size="middle"
            name="dangerGoodsControl"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入危爆物品管控"
              v-model="formValue.dangerGoodsControl"
              />
          </s-form-item>
          <s-form-item
            label="社区警务"
            size="middle"
            name="communityPolicing"
            :colon="true"
            :display-title="true"
            :rules="[{'max':255,'message':'最长为255位'}]"
          >
            <s-input
              :allow-clear="true"
              placeholder="请输入社区警务"
              v-model="formValue.communityPolicing"
              />
          </s-form-item>

        </s-form>
      </s-scroll>
    </div>
  </s-modal>
</template>

<script>

export default {
  name: 'Add',
  emits: ['change'],
  data() {
    return {
      formValue: {},
      confirmLoading: false,
      visible: false
    }
  },
  methods: {
    open() {
      this.formValue = {}
      this.visible = true
    },
    save() {
	  const _this=this
      const form = this.$refs.form
      form.validate((values,fullValue) => {
		
        this.confirmLoading = true
        this.$api.PUT('/modules/operateBusinessType/insert', values).then(res => {
          this.confirmLoading = false
          this.visible = false
          this.$emit('success');
          this.$message.info(res.msg)
        }).catch(() => {
          this.confirmLoading = false
        })
      })
    }
  }
}
</script>

<style lang="less" scoped>

</style>